package random.generators;

import java.util.ArrayList;
import java.util.List;

public class ExponetialDistributionGenerator implements DistributionGenerator {
	private double lambda;

	public ExponetialDistributionGenerator(double lambda) {
		super();
		this.lambda = lambda;
	}

	public List<Double> generateRandomNumbers(int n) {
		List<Double> ans = new ArrayList<Double>();
		for (int i = 0; i < n; i++) {
			double x = Math.random();
			double y = ((double) -1 / lambda) * Math.log(x);
			//
			ans.add(y);
			
			
		}
		return ans;
	}
	public Double distributionFunction (double y){
		return 1 - Math.exp(-lambda * y);
	}

}
